<template>
	<div>
		<div class="css-main">
			<div class="order-item">
					<div class="css-ordertop" @click="godetail">
						<div>
							<p class="fs-24 color-dark">订单编号：sn12345678987654321</p>
							<p class="fs-24 color-dark">下单时间： 2023-9-12 12：45</p>
						</div>
						<div class="order-state">{{ getStatusTxt() }}</div>
					</div>
					<div class="order-item-main" v-if="info.DetailList  && info.DetailList.length > 0" @click="godetail">
							<div class="order-item-imgs" >
									<div class="img-item" v-for="(item,index) in info.DetailList.slice(0,3)" :key="index">
											<img mode="aspectFill" :src="item.ProductImage" class="order-item-img" />
									</div>
							</div>
							
							<div class="right">
									<div class="right-box">
											<span class="right-box-text" v-if="info.DetailList.length>4">···</span>
											<span class="right-box-text" v-if="info.DetailList.length>4">共{{getTotalNum()}}种</span>
											<img class="css-rightimg" src="@/assets/images/meal/right.png" />
									</div>
							</div>
							
					</div>
					<div class="css-btn" >
						<div class="flex">
									<span class="color-gray mt-10">合计:</span>
									<span class="css-price">¥{{getTotalPrice()}}</span>
							</div>
						<div>
							<button class="bg-primary color-white btn fs-28 lh-64 br-32" @click.stop="goPay" v-if="info.status === 0">完成订单</button>
							<button class="bg-primary color-white btn fs-28 lh-64 br-32" @click.stop="goPay" v-if="info.status === 1">取消订单</button>
						</div>						
					</div>    
					<div class="css-qita">
						<p class="flex-s-s color-gray fs-24">
							 <span>配送方式：自提</span>
							 <span>下单方式：扫码点餐</span>
						</p>
						<p class="flex-s-s color-gray fs-24 mt-15">
							 <span>下单会员：臧章</span>
							 <span>订单类型：门店订单</span>
						</p>
					</div>     
			</div>
		</div>
	</div>
	
</template>

<script>
export default {
  name: 'mendianOrder',
  components: {
	
  },
  props: {  
		info: {
      type: Object,
      required: true
    },

  },
  data() {
    return {
			
		
    }
  },
  watch: {
 
  },
  created() {

  },
  methods: {
		  getTotalNum(){
				let num = 0;
				this.info.DetailList.forEach(e=>{
					num +=e.Amount
				})
				return num;
			},
			getTotalPrice(){
				let price = this.info.PriceSum
				if(price<0){
					return 0.00
				}else{
					return price.toFixed(2)
				}
			},
			getStatusTxt(){
				let status = this.info .status
				switch (status) {
					case 0:
						 return '已付款'
						break;
					case 1:
						 return '待付款'
						break;
					case 2:
						 return '已完成'
						break;
					default:
						break;
				}
			},
			//查看订单详情
			godetail(){
				let id = this.info.id
				this.$router.push(`/mealOrderDetail/${id}`)
			},
			cancle(){

			},
			goPay(){

			},
  }
}
</script>
<style lang="scss" scoped>
@import "index.scss";
.css-mendian{
		margin-left: 15rpx;
}
.right{
	.right-box{
		display: flex;
		flex-direction: row;
		align-items: flex-end;
		justify-content: flex-end;
		.right-box-text{
			color: #333333;
			font-size: 24px;
			padding-right: 10px;
			//font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			letter-spacing: 2px;
		}
	}
	.order-desc{
		color: #999;
	}
}
.pro-text{
	font-size: 28px;
	font-weight: 600;
}
.css-rightimg{
	width: 32px;
	height: 32px;
	margin-top: 5px;
}
.css-main{
	margin: 30px;
	background: white;
	padding: 30px;
	border-radius: 16px;
}
.css-btn{
  display: flex;
	justify-content: space-between;
	margin-top: 20px;
}
.btn-right{

}
.btn {
		width: 170px;
		padding: 0;
		height: 64px;
		line-height: 64px;
		border-radius: 32px;
		text-align: center;
}
.css-dzf{
	background: #FFF3DB;
	height: 72px;
	line-height: 72px;
	margin: 30px 30px -30px 30px;
	border-radius: 16px 16px 0 0 ;
}
.css-price{
	font-weight: 700;
	margin-left: 20px;
	color: $primary;
	font-size: 32px;
}
.css-qita{
	background: #F5F6F8;
	border-radius: 16px;
	padding: 22px 32px;
	margin-top: 20px;
}
</style>
